home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="UTF-8"?>
- <!--Convert Open Contacts' XML into HTML with hCard tags. You may copy/past the result into your Web pages.
- In order to publish public info only with privacy concern, you may comment out some XML codes or simply remove
- some HTML results.
-
- This file is useful for publishing selected contact info to the Web pages.
- -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="html" omit-xml-declaration="yes" encoding="UTF-8" />
-
- <xsl:template match="/">
- <html>
-
- <body>
- <xsl:for-each select="OpenContacts/Contacts/Contact">
- <div class="vcard">
- <table border="0" width="100%" id="table2">
- <tr>
- <td width="80%">
- <font face="Times New Roman" size="3">
- <b>
- <span class="fn">
- <xsl:value-of select="@Name"/>
- </span>
- </b>
- </font>
- </td>
- <td>
- <xsl:value-of select="@Title"/>
- </td>
- </tr>
- </table>
- <div style="margin-left: 15px;">
-
- <font size="2" color="#800000">
- <xsl:apply-templates select="Notes"/>
- </font>
-
-
- </div>
- <!--You may pick up some fields to be published by absolute path rather than using for-each-->
- <xsl:for-each select="Sections/Section">
- <div style="margin-left: 15px;">
-
-
- <b>
- <font face="Times New Roman" size="2">
- <xsl:value-of select="@Name"/>
- </font>
- </b>
- </div>
-
- <!--You may test against field name or field action type-->
- <table border="0" width="100%" id="table1" cellspacing="0" cellpadding="0">
- <xsl:for-each select="Fields/Field">
- <xsl:if test="not(@Action='map')">
- <tr>
-
- <xsl:choose>
- <xsl:when test="@Action='email'">
- <td width="15"></td>
- <td width="80" bgcolor="#C3D9FF">
- <font face="Times New Roman" size="2">
- <xsl:value-of select="@Name"/>:
- </font>
- </td>
- <td bgcolor="#E0ECFF">
- <font size="3">
- <a class="email" href="mailto:{@Value}">
- <xsl:value-of select="@Value"/>
- </a>
- </font>
- </td>
- </xsl:when>
-
- <xsl:when test="@Action='web'">
- <td width="15"></td>
- <td width="80" bgcolor="#C3D9FF">
- <font face="Times New Roman" size="2">
- <xsl:value-of select="@Name"/>:
- </font>
- </td>
- <td bgcolor="#E0ECFF">
- <font size="3">
- <!--Case insensitive match is not big concern.-->
- <xsl:if test="starts-with(@Value, 'http://')">
- <a class="url" href="{@Value}">
- <xsl:value-of select="@Value"/>
- </a>
- </xsl:if>
- <xsl:if test="not(starts-with(@Value, 'http://'))">
- <a class="url" href="http://{@Value}">
- <xsl:value-of select="@Value"/>
- </a>
- </xsl:if>
- </font>
- </td>
- </xsl:when>
-
- <xsl:when test="@Action='phone'">
- <td width="15"></td>
- <td width="80" bgcolor="#C3D9FF">
- <font face="Times New Roman" size="2">
- <xsl:value-of select="@Name"/>:
- </font>
- </td>
- <td bgcolor="#E0ECFF">
- <font size="3">
- <span class="tel">
- <xsl:value-of select="@Value"/>
- </span>
- </font>
- </td>
- </xsl:when>
-
-
- <!--You may render phone action type above to skype uri-->
- <xsl:when test="@Action='skype'">
- <td width="15"></td>
- <td width="80" bgcolor="#C3D9FF">
- <font face="Times New Roman" size="2">
- <xsl:value-of select="@Name"/>:
- </font>
- </td>
- <td bgcolor="#E0ECFF">
- <font size="3">
- <a href="skype:{@Value}">
- <xsl:value-of select="@Value"/>
- </a>
- </font>
- </td>
- </xsl:when>
-
- <xsl:when test="@Name='AIM'">
- <td width="15"></td>
- <td width="80" bgcolor="#C3D9FF">
- <font face="Times New Roman" size="2">
- <xsl:value-of select="@Name"/>:
- </font>
- </td>
- <td bgcolor="#E0ECFF">
- <font size="3">
- <a class="url" href="aim:goim?screenname={@Value}">
- <xsl:value-of select="@Value"/>
- </a>
- </font>
- </td>
- </xsl:when>
-
- <xsl:when test="@Name='Yahoo'">
- <td width="15"></td>
- <td width="80" bgcolor="#C3D9FF">
- <font face="Times New Roman" size="2">
- <xsl:value-of select="@Name"/>:
- </font>
- </td>
- <td bgcolor="#E0ECFF">
- <font size="3">
- <a class="url" href="ymsgr:sendIM?{@Value}">
- <xsl:value-of select="@Value"/>
- </a>
- </font>
- </td>
- </xsl:when>
-
- <xsl:when test="@Name='MSN'">
- <td width="15"></td>
- <td width="80" bgcolor="#C3D9FF">
- <font face="Times New Roman" size="2">
- <xsl:value-of select="@Name"/>:
- </font>
- </td>
- <td bgcolor="#E0ECFF">
- <font size="3">
- <a class="url" href="msnim:chat?contact={@Value}">
- <xsl:value-of select="@Value"/>
- </a>
- </font>
- </td>
- </xsl:when>
-
- <xsl:when test="@Name='ICQ'">
- <td width="15"></td>
- <td width="80" bgcolor="#C3D9FF">
- <font face="Times New Roman" size="2">
- <xsl:value-of select="@Name"/>:
- </font>
- </td>
- <td bgcolor="#E0ECFF">
- <font size="3">
- <a class="url" type="application/x-icq"
- href="http://www.icq.com/people/cmd.php?uin=[{@Value}]&action=message">
- <xsl:value-of select="@Value"/>
- </a>
- </font>
- </td>
- </xsl:when>
-
- <xsl:when test="@Name='Title'">
- <td width="15"></td>
- <td width="80" bgcolor="#C3D9FF">
- <font face="Times New Roman" size="2">
- <xsl:value-of select="@Name"/>:
- </font>
- </td>
- <td bgcolor="#E0ECFF">
- <font size="3">
- <span class="title">
- <xsl:value-of select="@Value"/>
- </span>
- </font>
- </td>
- </xsl:when>
-
- <xsl:otherwise>
- <!-- Ohters not being published-->
-
- </xsl:otherwise>
-
- </xsl:choose>
-
- </tr>
- </xsl:if>
- </xsl:for-each>
-
- <xsl:if test="count(Fields/Field[@Action='map']) > 0">
- <tr>
- <td width="15"></td>
- <td width="80" bgcolor="#C3D9FF">
- <font face="Times New Roman" size="2">
-
- <xsl:text>Address:</xsl:text>
-
- </font>
- </td>
-
- <td bgcolor="#E0ECFF">
- <font size="3">
-
- <span class="adr">
- <xsl:if test="Fields/Field[@Name='Unit']">
- <span class="extended-address">
- <xsl:value-of select="Fields/Field[@Name='Unit']/@Value"/>
- </span>
- </xsl:if>
-
- <xsl:if test="Fields/Field[@Name='Geo']">
- <span class="geo">
- <span class="latitude">
- <xsl:value-of select="substring-before(Fields/Field[@Name='Geo']/@Value, ',')"/>
- </span>,
- <span class="longitude">
- <xsl:value-of select="substring-after(Fields/Field[@Name='Geo']/@Value, ',')"/>
- </span>
- </span>
- </xsl:if>
-
- <xsl:if test="Fields/Field[@Name='Address']">
- <span class="street-address">
- <xsl:value-of select="Fields/Field[@Name='Address']/@Value"/>
- </span>
- </xsl:if>
-
- <xsl:if test="Fields/Field[@Name='Street']">
- <span class="street-address">
- <xsl:value-of select="Fields/Field[@Name='Street']/@Value"/>
- </span>
- <xsl:if test="Fields/Field[@Name='City']">, </xsl:if>
- </xsl:if>
- <xsl:if test="Fields/Field[@Name='City']">
- <span class="locality">
- <xsl:value-of select="Fields/Field[@Name='City']/@Value"/>
- </span>
- <xsl:if test="Fields/Field[@Name='State']">, </xsl:if>
- </xsl:if>
- <xsl:if test="Fields/Field[@Name='State']">
- <span class="region">
- <xsl:value-of select="Fields/Field[@Name='State']/@Value"/>
- </span>
- <xsl:if test="Fields/Field[@Name='Postcode']">
- <xsl:text> </xsl:text>
- </xsl:if>
- </xsl:if>
- <xsl:if test="Fields/Field[@Name='Postcode']">
- <span class="postal-code">
- <xsl:value-of select="Fields/Field[@Name='Postcode']/@Value"/>
- </span>
- <xsl:if test="Fields/Field[@Name='Country']">
- <xsl:text>, </xsl:text>
- </xsl:if>
- </xsl:if>
- <xsl:if test="Fields/Field[@Name='Country']">
- <span class="country-name">
- <xsl:value-of select="Fields/Field[@Name='Country']/@Value"/>
- </span>
- </xsl:if>
- </span>
- </font>
- </td>
- </tr>
- </xsl:if>
- </table>
-
- <div class="note" style="margin-left: 15px;">
-
- <font size="2" color="#800000">
- <xsl:apply-templates select="Notes"/>
- </font>
-
-
- </div>
- </xsl:for-each>
-
- <p> </p>
-
- </div>
- </xsl:for-each>
-
-
-
-
-
- </body>
- </html>
- </xsl:template>
-
-
- <xsl:template match="Notes">
- <xsl:call-template name="substitute">
- <xsl:with-param name="string" select="." />
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="substitute">
- <xsl:param name="string" />
- <xsl:param name="from" select="'
'" />
- <xsl:param name="to">
- <p/>
- </xsl:param>
- <xsl:choose>
- <xsl:when test="contains($string, $from)">
- <xsl:value-of select="substring-before($string, $from)" />
- <xsl:copy-of select="$to" />
- <xsl:call-template name="substitute">
- <xsl:with-param name="string"
- select="substring-after($string, $from)" />
- <xsl:with-param name="from" select="$from" />
- <xsl:with-param name="to" select="$to" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$string" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- </xsl:stylesheet>